const menuService = require('../services/menuService');
const asyncHandler = require('../middlewares/asyncHandler'); 


const getAllMenus = asyncHandler(async (req) => {
  return await menuService.getAllMenus();
});

const initMenus = asyncHandler(async (req) => {
  return await menuService.initMenus();
});

const createMenu = asyncHandler(async (req) => {
  return await menuService.createMenu(req.body);
});
const updateMenu = asyncHandler(async (req) => {
    return await menuService.updateMenu(req.params.id, req.body);
})
const deleteMenu = asyncHandler(async (req) => {
    return await menuService.deleteMenu(req.params.id);
})
const getRoleMenus = asyncHandler(async (req) => {
    return await menuService.getRoleMenus(req.user.userId);
})
module.exports = {
  getAllMenus,
  initMenus,
  createMenu,
  updateMenu,
  deleteMenu,
  getRoleMenus
};
